<?xml version="1.0" encoding="ISO-8859-1" ?>
<!--

    Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Distribution License v. 1.0, which is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

    SPDX-License-Identifier: BSD-3-Clause

-->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en"
      xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListContactTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
        <h:form styleClass="jsfcrud_list_form">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: #d20005" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:outputText escape="false" value="#{bundle.ListContactEmpty}" rendered="#{contactController.items.rowCount == 0}"/>
            <h:panelGroup rendered="#{contactController.items.rowCount > 0}">
                <h:outputText value="#{contactController.pagination.pageFirstItem + 1}..#{contactController.pagination.pageLastItem + 1}/#{contactController.pagination.itemsCount}"/>&nbsp;
                <h:commandLink action="#{contactController.previous}" value="#{bundle.Previous} #{contactController.pagination.pageSize}" rendered="#{contactController.pagination.hasPreviousPage}"/>&nbsp;
                <h:commandLink action="#{contactController.next}" value="#{bundle.Next} #{contactController.pagination.pageSize}" rendered="#{contactController.pagination.hasNextPage}"/>&nbsp;
                <h:dataTable value="#{contactController.items}" var="item" summary="Contact list" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListContactTitle_id}"/>
                        </f:facet>
                        <h:outputText value="#{item.id}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListContactTitle_lastName}"/>
                        </f:facet>
                        <h:outputText value="#{item.lastName}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListContactTitle_firstName}"/>
                        </f:facet>
                        <h:outputText value="#{item.firstName}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListContactTitle_birthday}"/>
                        </f:facet>
                        <h:outputText value="#{item.birthday}">
                            <f:convertDateTime pattern="MM/dd/yyyy" />
                        </h:outputText>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListContactTitle_homePhone}"/>
                        </f:facet>
                        <h:outputText value="#{item.homePhone}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListContactTitle_mobilePhone}"/>
                        </f:facet>
                        <h:outputText value="#{item.mobilePhone}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListContactTitle_email}"/>
                        </f:facet>
                        <h:outputText value="#{item.email}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="&nbsp;"/>
                        </f:facet>
                        <h:commandLink action="#{contactController.prepareView}" value="#{bundle.ListContactViewLink}"/>
                        <h:outputText value=" "/>
                        <h:commandLink action="#{contactController.prepareEdit}" value="#{bundle.ListContactEditLink}"/>
                        <h:outputText value=" "/>
                        <h:commandLink action="#{contactController.destroy}" value="#{bundle.ListContactDestroyLink}"/>
                    </h:column>
                </h:dataTable>
            </h:panelGroup>
            <br />
            <h:commandLink action="#{contactController.prepareCreate}" value="#{bundle.ListContactCreateLink}"/>
            <br />
            <br />
            <h:commandLink value="#{bundle.ListContactIndexLink}" action="/index" immediate="true" />
        </h:form>
        </ui:define>
    </ui:composition>

</html>
